
library(testthat)
library(blma)
library(tictoc)
library(parallel)

cores <- detectCores()

test_that('eyeData produces correct results liang_g_n_quad', {
	set.seed(2019)
	eyeData <- get_eyeData()
    vy <- eyeData$vy
    mX <- eyeData$mX
    p <- ncol(mX)
    tic('eyeData produces correct results liang_g_n_quad')
    result <- sampler(100000, vy, mX, prior='liang_g_n_quad', modelprior='beta-binomial', modelpriorvec=c(1, p), cores=cores)
    toc()
    expect_equal(result$vinclusion_prob, 
c(
0.003250000000000000,0.005040000000000000,0.001490000000000000,
0.001730000000000000,0.002650000000000000,0.003510000000000000,
0.001410000000000000,0.003790000000000000,0.001790000000000000,
0.002090000000000000,0.058830000000000000,0.003240000000000000,
0.002910000000000000,0.001950000000000000,0.001560000000000000,
0.003160000000000000,0.001370000000000000,0.001640000000000000,
0.002520000000000000,0.001380000000000000,0.001550000000000000,
0.001720000000000000,0.002040000000000000,0.001430000000000000,
0.001420000000000000,0.003460000000000000,0.001570000000000000,
0.009760000000000000,0.001290000000000000,0.003570000000000000,
0.004240000000000000,0.001340000000000000,0.002590000000000000,
0.001790000000000000,0.001730000000000000,0.005940000000000000,
0.001480000000000000,0.002590000000000000,0.001640000000000000,
0.001550000000000000,0.001570000000000000,0.040349999999999997,
0.001750000000000000,0.001640000000000000,0.001380000000000000,
0.001950000000000000,0.001610000000000000,0.001550000000000000,
0.002350000000000000,0.005880000000000000,0.001660000000000000,
0.003730000000000000,0.001610000000000000,0.010380000000000000,
0.009490000000000000,0.001230000000000000,0.001850000000000000,
0.002170000000000000,0.002580000000000000,0.010200000000000001,
0.001400000000000000,0.028000000000000001,0.002120000000000000,
0.002330000000000000,0.002010000000000000,0.007410000000000000,
0.001750000000000000,0.001640000000000000,0.001380000000000000,
0.002000000000000000,0.013729999999999999,0.001470000000000000,
0.001590000000000000,0.002000000000000000,0.001670000000000000,
0.017960000000000000,0.001820000000000000,0.002800000000000000,
0.001470000000000000,0.001840000000000000,0.001460000000000000,
0.001460000000000000,0.001660000000000000,0.001710000000000000,
0.004440000000000000,0.001830000000000000,0.174080000000000013,
0.001960000000000000,0.002340000000000000,0.021350000000000001,
0.001370000000000000,0.005250000000000000,0.002810000000000000,
0.001230000000000000,0.001660000000000000,0.004330000000000000,
0.001850000000000000,0.001410000000000000,0.014090000000000000,
0.001980000000000000,0.002280000000000000,0.009290000000000000,
0.001260000000000000,0.003390000000000000,0.001540000000000000,
0.001780000000000000,0.003390000000000000,0.003730000000000000,
0.023640000000000001,0.008250000000000000,0.003920000000000000,
0.015210000000000000,0.003870000000000000,0.001930000000000000,
0.001810000000000000,0.001470000000000000,0.003480000000000000,
0.001440000000000000,0.001650000000000000,0.001560000000000000,
0.001720000000000000,0.001320000000000000,0.006700000000000000,
0.002820000000000000,0.007939999999999999,0.001500000000000000,
0.009800000000000000,0.001720000000000000,0.001640000000000000,
0.001560000000000000,0.001720000000000000,0.008529999999999999,
0.001370000000000000,0.008300000000000000,0.004600000000000000,
0.024539999999999999,0.002480000000000000,0.001500000000000000,
0.001830000000000000,0.010200000000000001,0.010950000000000000,
0.001550000000000000,0.001900000000000000,0.001420000000000000,
0.001690000000000000,0.007060000000000000,0.008109999999999999,
0.003540000000000000,0.001390000000000000,0.001560000000000000,
0.002860000000000000,0.002460000000000000,0.950130000000000030,
0.005550000000000000,0.033149999999999999,0.001570000000000000,
0.008550000000000000,0.007780000000000000,0.014040000000000000,
0.002160000000000000,0.005580000000000000,0.006210000000000000,
0.002660000000000000,0.016109999999999999,0.002190000000000000,
0.001980000000000000,0.001290000000000000,0.002260000000000000,
0.001330000000000000,0.003810000000000000,0.001640000000000000,
0.025040000000000000,0.003660000000000000,0.002130000000000000,
0.003500000000000000,0.002340000000000000,0.006620000000000000,
0.001360000000000000,0.002320000000000000,0.756449999999999956,
0.058259999999999999,0.017840000000000002,0.007320000000000000,
0.004340000000000000,0.742110000000000047,0.001890000000000000,
0.044319999999999998,0.009889999999999999,0.003400000000000000,
0.003170000000000000,0.001730000000000000,0.001550000000000000,
0.001340000000000000,0.001560000000000000,0.001340000000000000,
0.003910000000000000,0.001760000000000000,0.002360000000000000,
0.003800000000000000,0.053039999999999997
)
, tolerance = 1e-8)
})